Fix detection of named prefix bindings
authorJustin Burkett <justin@burkett.cc>
Mon, 21 Jun 2021 19:44:07 +0000 (15:44 -0400)
committerJustin Burkett <justin@burkett.cc>
Mon, 21 Jun 2021 19:44:07 +0000 (15:44 -0400)
which-key.el

index ebed572255af9929a4def37605b7077ecc944910..831e7d51a9237e6b825f466e9fdca7138d71acb3 100644 (file)
@@ -1401,7 +1401,9 @@ Uses `string-lessp' after applying lowercase."
   (string-lessp (downcase (cdr acons)) (downcase (cdr bcons))))
 
 (defsubst which-key--group-p (description)
-  (or (equal description "prefix")
+  (or (string-equal description "prefix")
+      (and (length> description 6)
+           (string-equal (substring description 0 6) "group:"))
       (keymapp (intern description))))
 
 (defun which-key-prefix-then-key-order (acons bcons)
@@ -1789,11 +1791,11 @@ Requires `which-key-compute-remaps' to be non-nil"
                             ((keymapp def) "prefix")
                             ((symbolp def) (which-key--compute-binding def))
                             ((eq 'lambda (car-safe def)) "lambda")
-                            ((eq 'menu-item (car-safe def))
-                             (which-key--get-menu-item-binding def))
                             ((stringp def) def)
                             ((vectorp def) (key-description def))
-                            ((consp def) (car def))
+                            ((consp def) (concat (when (keymapp (cdr-safe def))
+                                                   "group:")
+                                                 (car def)))
                             (t "unknown")))))
                (when (or (null filter)
                          (and (functionp filter)